package com.google.api.sample;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author Jenny Murphy
 */
@SuppressWarnings("serial")
public class ClearSessionServlet extends HttpServlet {
  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    HttpSession session = req.getSession();
    session.removeAttribute("accessToken");
    session.removeAttribute("refreshToken");

    // With the accessToken cleared out, return to the index
    resp.sendRedirect("/");
  }
}
